package com.chuiyan.topnews;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

public class Detail_img extends AppCompatActivity {
    private ImageView back;
    private ImageView love;
    private ImageView collect;
    private ImageView sendComment;
    private EditText commentEdit;
    private boolean loved = false;
    private boolean collected = false;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detail_img);
        back = findViewById(R.id.back);
        love = findViewById(R.id.love);
        collect = findViewById(R.id.collect);
        sendComment = findViewById(R.id.sendComment);
        commentEdit = findViewById(R.id.commentEdit);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        love.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(loved){
                    love.setImageResource(R.drawable.ic_love);
                }else{
                    love.setImageResource(R.drawable.ic_loved);
                    loved = true;
                }

            }
        });
        collect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(collected){
                    collect.setImageResource(R.drawable.ic_collect);
                }else{
                    collect.setImageResource(R.drawable.ic_collected);
                    collected = true;
                }

            }
        });

    }
}
